<template>
	<view class="authorization">
		<!-- 我的授权 -->
		<view class="header">
			<uniNavBar leftImg="/static/h5img/return_black@2x.png" @clickLeft="clickLeft" title="我的授权"></uniNavBar>
		</view>
		<view class="img-box" id="sharePicBox">
			<image class="author-img" :src="url"></image>
		</view>
	</view>
</template>

<script>
import api from '@/common/api';
import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue';
import { ifLogin } from '@/common/js/index'
export default {
	data() {
		return {
			token: '',
			url: '',
		};
	},
	components: {
		uniNavBar
	},
	methods: {
		clickLeft() {
			uni.navigateBack();
		},
		async getAuthorization() {
			this.token = uni.getStorageSync('token');
			const [err, res] = await api.authorize({
				method: 'get',
				header: {
					'Content-Type': 'application/json;charset=UTF-8',
					token: this.token
				}
			});
			if (res) {
				const {
					data: content = {},
					data: { code, data = '' }
				} = res;
				console.log(data,code)
				if (code === 0 && data) {
					this.url = `https://static.xpandago.net/${data}`
				}
			}
		}
	},
	onLoad() {
		const status = ifLogin()
		if (status) {
			this.getAuthorization();
		}
	},
};
</script>

<style scoped lang="scss">
body,
uni-page-body {
	height: 100%;
}
.authorization {
	height: 100%;
	.header {
		position: fixed;
		width: 100%;
		background-color: #fff;
	}
	.img-box {
		&::before {
			height: 88rpx;
			content: '';
			display: block;
		}
		overflow: hidden;
		height: 100%;
		width: 100%;
		.author-img {
			height: calc(100% - 88rpx);
			width: 100%;
		}
	}
	.code {
		z-index: 2;
		position: relative;
		left: 428rpx;
		top: -592rpx;
	}
	.signature {
		position: relative;
		top: -668rpx;
		left: 306rpx;
		z-index: 2;
	}
}
</style>
